<!DOCTYPE html>
<html>
<head>
    <title>require.js: Layers Test</title>
    <script type="text/javascript">
        requirejsArgs = {
            dojoLocation: "../../../../.."
        };
    </script>
    <script type="text/javascript" src="../requirejs-setup.js"></script>
    <script type="text/javascript" src="../../../../../dojo.js"></script>
    <script type="text/javascript">
        require(["doh"], function (doh) {
            var master = new doh.Deferred();
            doh.register(
                    "layers",
                    [
                        {
                            name: "layers",
                            timeout: 5000,
                            runTest: function () {
                                return master;
                            }
                        }
                    ]
            );
            doh.run();

            require(
                    {
                        baseUrl: "./"
                    },
                    ["require", "layer1"],
                    function (require) {
                        require(["alpha", "beta", "gamma", "epsilon"],
                                function (alpha, beta, gamma, epsilon) {
                                    doh.is("alpha", alpha.name);
                                    doh.is("beta", alpha.betaName);
                                    doh.is("beta", beta.name);
                                    doh.is("gamma", beta.gammaName);
                                    doh.is("gamma", gamma.name);
                                    doh.is("epsilon", gamma.epsilonName);
                                    doh.is("epsilon", epsilon.name);
                                }
                        );

                        var verifyFunc = function () {
                            var regExp = /alpha|beta|gamma/,
                                    i,
                                    scripts = document.getElementsByTagName("script");
                            for (var i = scripts.length - 1; i > -1; i--) {
                                doh.f(regExp.test(scripts[i].src));
                            }
                            master.callback(true);
                        };

                        setTimeout(verifyFunc, 3000);
                    }
            );
        });
    </script>
</head>
<body>
<h1>require.js: Layers Test</h1>

<p>Check console for messages</p>
</body>
</html>
